package com.example.merchant.service;

import com.example.merchant.entity.Commodity;
import com.example.merchant.entity.FruitType;
import com.example.merchant.entity.Merchant;
import org.springframework.stereotype.Service;

@Service("GRAPE")

/**
 * 创建商品
 */


public class CreateCommodityService {


    Merchant m = MockDatabase.merchant();
    Commodity c = new Commodity();

    public Commodity creatCommodity(Merchant merchant) {
        Commodity commodity = new Commodity();
        commodity.setId(2);
        commodity.setMerchantId(merchant.getId());
        commodity.setFruitType(FruitType.BANANA);
        commodity.setName("巴蕉");
        commodity.setMoney(300.00);
        //commodity.setSum(10);//苹果数量
        return commodity;

    }

    public String createCommodity1() {
        c.setId(3);
        c.setMerchantId(m.getId());
        c.setFruitType(FruitType.GRAPE);
        c.setName("水晶葡萄");
        c.setMoney(200.00);
        return "老板：" + m.getName() + "\t\t" + "商品名称：" + c.getName() + "\t\t" + "商品价格：" + c.getMoney();
    }

    public String createCommodity2(Integer x, FruitType fruitType, String name, Double money) {
        c.setId(x);
        c.setMerchantId(m.getId());
        c.setFruitType(fruitType);
        c.setName(name);
        c.setMoney(money);
        return "老板：" + m.getName() + "\t\t" + "商品名称：" + c.getName() + "\t\t" + "商品价格：" + c.getMoney();
    }


}
